'use strict';

const Controller = require('egg').Controller;

class DownloadController extends Controller {
  async xls() {
    const { ctx } = this;
    ctx.set('Content-Type', 'application/octet-stream');
    ctx.attachment('download.xlsx');
    const workbook = await ctx.service.download.xls();
    ctx.body = await workbook.xlsx.writeBuffer();
  }
}

module.exports = DownloadController;
